Revamped main wnd
[saphira-test.git] / Docs / Coding Style
blob2b8d18e04b6e2dd348140e6be5a456bfa11ea3ff
1 /* This document will contain general rules of coding style that should be obeyed */
4 Glade widget naming guidelines:
5 ---------------------
6 - Widgets should be named according to the following examples:
7         * btn_burn_start
8         * dlg_properties
9         * wnd_main
10         * lbl_burn_status
13 C Code guidelines:
14 -------------------
15 -       Never more than 80 chars horizontally
16 -       Only use C-Style commenting
17 -       function names: lower case, separated by underscore
18 -       Using lint is strongly recommended
19 -       Use 4 spaces, not tabs
20 -       Use GLIB where possible (e.g. no malloc, but rather g_new)
22 Code should be formatted according to following example:
24 # include "stdio.h"
26 char *buffer;                   /* Comments to the right of declarations */
27 char *start, *end, *last;
28 char *name;
29 /*         This separates blocks of declarations */
30 int baz;
32 struct square {
33     int x;
34     int y;
37 #ifdef ENABLE_NLS
38         bindtextdomain(GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
39 #else                   /* Comments to the right of preproc directives */
40         textdomain(PACKAGE);
41 #endif
43 int
44 foo(int number, int len, char *name)
46     if (number > 0) {
47         for (int i = 0; i < 7; i++)
48             len++;
49         number--;
50     } else {
51         while (len) {
52         len--};
53         number++;
54     }
55     puts("Hi");
58 /* 
59  The procedure bar is even less interesting.
60  it does nothing particular :) 
61  */
62 char*
63 bar(int nb)
65     long c;
66     c = (long) foo(2, 5, "end");
67     
68     /* Write "Hello" to Console */
69     puts("Hello");              
70     
71     switch (nb) {
72     case 0:
73         break;
74     case 1:
75         nb++;
76         break;  
77     default:
78         break;
79     }
82 int
83 bool_test(char *mask)
85     if (mask
86         && ((mask[0] == '\0') ||
87             (mask[1] == '\0' && ((mask[0] == '0') || (mask[0] == '*')))))
88         return 0;
91 int
92 function_with_lots_of_arguments(char* arg1, char* arg2, int arg3, int arg4,
93         char* arg5, void* arg6, int arg7, float arg8, float arg9, float arg10,
94         int arg11, char* arg12)
96         return 0;